package com.aaa.inside.service.impl;

import com.aaa.entity.inside.Allocation;
import com.aaa.entity.inside.Puton;
import com.aaa.inside.mapper.AllocationMapper;
import com.aaa.inside.service.AllocationService;
import com.aaa.vo.R;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author aaa
 * @since 2020-12-07
 */
@Service
public class AllocationServiceImpl extends ServiceImpl<AllocationMapper, Allocation> implements AllocationService {

    @Override
    public R searchAllo(Integer page, Integer limit, Allocation allocation) {
        Page<Allocation> pageinfo=new Page<>(page,limit);
        String allocationno=allocation.getAllocationno();
        String state=allocation.getState();
        QueryWrapper<Allocation> queryWrapper=new QueryWrapper<>();
        if(StringUtils.isNotEmpty(allocationno)){
            queryWrapper.like("allocationno",allocationno);
        }
        if(StringUtils.isNotEmpty(state)){
            queryWrapper.like("state",state);
        }
        this.baseMapper.selectPage(pageinfo,queryWrapper);
        return R.ok().message("查询成功").data("pageinfo",pageinfo);
    }
}
